{%extends "summary_base.html" %}

{% block title %}LibraryHippo Audit Log{% endblock title %}
{% block header %}LibraryHippo Audit Log - {{ previouspage }} Days Ago{% endblock header %}

{% block scripts %}
    {{ super() }}
    <script src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
    <script src="/static/scripts/lh_jquery.js"></script>
    <script type="text/javascript">
      function toggle_details(button)
      {
        $detail_row = $(button).closest("tr").next("tr");
        if ($detail_row.css('display') == "none")
        {
          $detail_row.show();
          $(button).html("&nbsp;&laquo;&nbsp;");
        }
        else
        {
          $detail_row.hide();
          $(button).html("&nbsp;&raquo;&nbsp;");
        }
      }
    </script>
{% endblock scripts %}

{% block content %}
<div id="log">
<table width="100%" class="grid">
<thead>
  <th>class</th>
  <th>when</th>
  <th>family</th>
  <th>user</th>
</thead>
<tbody>
{% for event in events %}
  <tr>
    <td>{{ event.class_name() }}</td>
    <td title="{{ event.date_time_saved }}">{{ event.date_time_saved|humanize_time }}</td>
    <td>{{ event.family }}</td>
    <td>{{ event.user }}</td>
    <td><a onclick="toggle_details(this); return false;" href="#">&nbsp;&raquo;&nbsp;</a></td>
  </tr>
<tr id="detail_{{ loop.counter }}" style="display:none;">
  <td>&nbsp;</td>
    <td colspan="4">{{ event.exception }}</td>
  </tr>
{% endfor %}
</tbody>
</table>
<div>
<a href="/admin/auditlog">latest</a>
{% if previouspage %}
<a href="/admin/auditlog/{{ previouspage }}">newer</a>
{%endif %}
<a href="/admin/auditlog/{{ nextpage }}">older</a>
</div>
</div>
{% endblock content %}
